<?php

require_once("../../controllers/init.php");
require_once($FILE_SYSTEM_ROOT."/controllers/authentication.php");

$choir="all";
if($_POST['choir']=="music-choir-menu-button-showboys")
	$choir="boys";
elseif($_POST['choir']=="music-choir-menu-button-showgirls")
	$choir="girls";
elseif($_POST['choir']=="music-choir-menu-button-showclerks")
	$choir="clerks";

$music = new MusicResultSet($choir);
$music->setStartDate(new DateTime('now'));
if(isset($_POST['showAll'])) 
{
	if($_POST['showAll']=='true')
	{
		$music->setStartDate(new DateTime('2000-01-01'));
	}
}

$musicArray = $music->getMusic();

foreach ($musicArray as $musicEvent)
{
	print "<div class=\"musiclist-table\" id=\"music-event-".$musicEvent->getID()."\">";
	
	print "<div class=\"musiclist-table-day\">".$musicEvent->getDateTime()->format("D")."</div>";
	print "<div class=\"musiclist-table-date\">".$musicEvent->getDateTime()->format("j M Y")."</div>";
	print "<div class=\"musiclist-table-time\">".$musicEvent->getDateTime()->format("H:i")."</div>";
//	print "<div class=\"musiclist-table-edatetime\">".$musicEvent->geteDateTime()->format("j M Y")."</div>";
	print "<div class=\"musiclist-table-choir\">".$musicEvent->getChoir()."</div>";
	print "<div class=\"musiclist-table-eventtitle\">".$musicEvent->getTitle()."</div>";
	print "<div class=\"musiclist-table-note\">".$musicEvent->getNote()."</div>";
	print "<div class=\"musiclist-table-service\">".$musicEvent->getService()."</div>";
	print "<div class=\"musiclist-table-psalms\">".$musicEvent->getPsalms()."</div>";
	print "<div class=\"musiclist-table-hymns\">".$musicEvent->getHymns()."</div>";
	print "<div class=\"musiclist-table-introit\">".$musicEvent->getIntroit()."</div>";
	print "<div class=\"musiclist-table-responses\">".$musicEvent->getResponses()."</div>";
	print "<div class=\"musiclist-table-mass\">".$musicEvent->getMass()."</div>";
	print "<div class=\"musiclist-table-canticles\">".$musicEvent->getCanticles()."</div>";
	print "<div class=\"musiclist-table-anthem\">".$musicEvent->getAnthem()."</div>";
	
	print "</div>";
}

?>
